package com.hao.crud.controller;

import com.hao.crud.bean.Department;
import com.hao.crud.bean.Msg;
import com.hao.crud.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author hao   email：huanghao.0508@qq.com
 * @ClassName：DpetController
 * @description ：TODO
 * @create 2020-10-30-16:13
 */
@Controller
public class DeptController {
    @Autowired
    private DepartmentService departmentService;
    //    获取所有的部门信息
    @RequestMapping("depts")
    @ResponseBody
    public Msg getDepts(){
        List<Department> depts = departmentService.getAll();
        return  Msg.success().add("depts",depts);
    }
}
